package logTest;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import log4j.Test;

public class logmian {
	
	private Logger logger=null;
	
	public logmian(Class clazz){
		logger = Logger.getLogger(clazz);
		InputStream inputStream = getClass().getResourceAsStream("log4j.properties");
		Properties properties = new Properties();	
		try {
			//加载配置文件
			properties.load(inputStream);
			PropertyConfigurator.configure(properties);
			inputStream.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void WriteDebug(Object Info){
		logger.debug(Info);
	}
	public void WriteInFo(Object Info){
		logger.info(Info);
	}
	public void WriteError(Object Info){
		logger.error(Info);
	}

}
